/**
 * @Title: index.js
 * @Description: index
 * @author: Fanchao
 * @date: 2020/8/15 6:36 下午
 * @version V1.0
 */
import React from 'react';

import styles from './index.less';
import SectionTitle from 'components/SectionTitle';
import { Col, Row } from 'antd';
import { connect } from 'umi';
import TableForm from '@/pages/evaluations/examination/[id]/components/table-form';

const EvaluationsDetail = ({ examinationTaskDetail: { detailData }, loading }) => {
    if (loading) return null;
    const {
        evaluatePlanSnapshotsModel,
        questionSnapshotsModelList,
    } = detailData;
    return (
        <div className={styles.taskDetailContainer}>
            <SectionTitle title={'评定对象'}/>
            <div className={styles.detailUserInfo}>
                <Row>
                    <Col span={6}>
                        <p className={styles.label}>问卷标号</p>
                        <p className={styles.value}>{detailData.examNo}</p>
                    </Col>
                    <Col span={6}>
                        <p className={styles.label}>问卷名称</p>
                        <p className={styles.value}>{detailData.examName}</p>
                    </Col>
                    <Col span={6}>
                        <p className={styles.label}>问卷类型</p>
                        <p className={styles.value}>{detailData.evaluateQuestionType}</p>
                    </Col>
                    <Col span={24}>
                        <p className={styles.label}>备注</p>
                        <p className={styles.value}>{detailData.comment}</p>
                    </Col>
                </Row>
            </div>
            <SectionTitle title={'评价任务'}/>
            <div className={styles.submitFormContainer}>
                <TableForm
                    questionSnapshotsModelList={questionSnapshotsModelList}
                    evaluatePlanSnapshotsModel={evaluatePlanSnapshotsModel}
                />
            </div>
        </div>
    );
};

export default connect(({ examinationTaskDetail, dispatch, loading }) => ({
    examinationTaskDetail,
    dispatch,
    loading: loading.effects['examinationTaskDetail/getExamDetailModel'],
}))(EvaluationsDetail);
